/**
 * Created by yy on 16-8-6.
 */
angular.module('admin', ['auth', 'ui.router', 'admin.resetPw', 'admin.studentOpt', 'admin.teacherOpt'])
    .config(function ($stateProvider) {
        $stateProvider.state('admin', {
            url: "/admin",
            templateUrl: "app/admin/admin.html",
            controller: 'adminCtrl'
        })})
    .controller('adminCtrl', function ($scope, $location, checkCredit, deleteCredit) {
        if (!checkCredit(7)) {
            $location.path('/login');
        }
        $scope.items = [
            {
                sref:'admin.resetPw',
                content:'重置密码',
            },
            {
                sref:'admin.studentOpt',
                content:'管理学生'
            },
            {
                sref:'admin.teacherOpt',
                content:'管理老师'
            }
        ];
        $scope.logout = function() {
            deleteCredit();
            $location.path('/login');
        };
    });
